/*
 * @Author: Jiraiya
 * @Date: 2020-03-13 10:31:24
 * @LastEditors: Jiraiya
 * @LastEditTime: 2020-03-13 14:34:15
 * @Description: 
 */
function sleep(ms, args){
    return new Promise((res)=>{
        setTimeout(() => {
            res(args)
        }, ms);
    })
}

function *f(){
    const result = yield sleep(1000, {data: 1});
    console.log(result.data)
}
const g = f();
g.next().value.then(res=>{
    g.next(res)
})